//
//  IManager+ModulePushMessage.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-10-1.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModulePushMessage.h"
#import "FrameworkRelativeDefines.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "NSString+NSString_Ex_.h"
#import "GloableEngineService.h"
#import "RCPushMessageDataModel.h"

@implementation IManager(ModulePushMessage)

-(int64_t)requestPushMessageInfo:(id<IManagerDelegate>)delegate{
    NSString *cityID = [GloableEngineService sharedInstance].selectedCityID;
    if ([NSString stringIsNullOrEmpty:cityID]) {
        return kInvalidRequestId;
    }
    
    NSString *urlSuffix = [NSString stringWithFormat:kRCPushMessagePrefix,cityID];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCPushMessageDataModel class]
                                                     withDataDelegate:delegate];
}

@end
